<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      th:replace="layout (title='用户详情')">

    <!-- page content -->
    <div class="right_col" role="main" th:fragment="content">
        <div class="">
            <div class="clearfix"></div>

            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>用户详情</h2>
                            <span class="bg-danger text-white" th:text="${MSG}"></span>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <form class="form-horizontal form-label-left" novalidate th:action="@{/user/update}" method="post">
                                <input type="hidden" name="id" th:value="${user.getId()}">

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="location">工作地点<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-6">
                                        <select id="location"   class="form-control" name="location">
                                            <option th:each="location : ${locations}"
                                                    th:value="${location.getId()}" th:text="${location.getName()}" th:selected="${user.getWard().getDepartment().getLocation().getName() eq location.getId()}">
                                        </select>
                                    </div>
                                </div>

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="department">部门<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-6">
                                        <select id="department"   class="form-control" name="department">
                                            <option th:each="dept : ${departments}"
                                                    th:value="${dept.getId()}" th:text="${dept.getName()}" th:selected="${user.getWard().getDepartment().getId() eq dept.getId()}"
                                            >
                                        </select>
                                    </div>
                                </div>


                            <form class="form-horizontal form-label-left" novalidate th:action="@{/user/update}" method="post">
                                <input type="hidden" name="id" th:value="${user.getId()}">
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="ward">病房<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-6">
                                        <select id="ward"   class="form-control" name="ward">
                                        <option th:each="ward : ${wards}"
                                        th:value="${ward.getId()}" th:text="${ward.getWardname()}" th:selected="${user.getWard().getId() eq ward.getId()}"
                                        >
                                        </select>
                                    </div>
                                </div>

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">用户名<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input id="name" class="form-control col-md-7 col-xs-12" name="name"  required="required" th:value="${user.getName()}" type="text">
                                    </div>
                                </div>

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="username">登录名<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input id="username" class="form-control col-md-7 col-xs-12"  name="username" th:value="${user.getUsername()}" type="text">
                                    </div>
                                </div>

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="password">密码<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input id="password" class="form-control col-md-7 col-xs-12"  name="password" th:value="${user.getPassword()}" type="password">
                                    </div>
                                </div>

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="worknumber">工号<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input id="worknumber" name="worknumber" required="required" class="form-control col-md-7 col-xs-12" th:value="${user.getIdnumber()}">
                                    </div>
                                </div>

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12"> 性别<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                            <div id="gender" class="btn-group" data-toggle="buttons">
                                                <!--<label class="btn btn-default" data-toggle-class="btn-primary"  data-toggle-passive-class="btn-default" th:classappend="${user.getSex() eq true}? 'active'">-->
                                                    <!--<input type="radio" name="sex" value="true"> &nbsp; Male &nbsp;-->
                                                <!--</label>-->
                                                <!--<label class="btn btn-default" data-toggle-class="btn-primary" data-toggle-passive-class="btn-default" th:classappend="${user.getSex() eq false}? 'active'">-->
                                                    <!--<input type="radio" name="sex" value="false"> Female-->
                                                <!--</label>-->
                                                <label for="optionsRadios1" class="btn btn-default" data-toggle-class="btn-primary"  data-toggle-passive-class="btn-default" th:classappend="${user.getSex() eq true}? 'active'">
                                                    <input id="optionsRadios1" type="radio" name="sex" value="true" th:checked="${user.getSex() eq true}" > &nbsp; Male &nbsp;
                                                </label>
                                                <label for="optionsRadios2" class="btn btn-default" data-toggle-class="btn-primary" data-toggle-passive-class="btn-default" th:classappend="${user.getSex() eq false}? 'active'">
                                                    <input id="optionsRadios2" type="radio" name="sex" value="false" th:checked="${user.getSex() eq false}"> Female
                                                </label>
                                            </div>
                                        </div>
                                </div>

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-3" for="birthday">出生年月<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                    <div class="input-group date col-md-3 col-sm-3 col-xs-3" id="birthday">
                                        <input type="text" class="form-control" name="birthday" th:value="${#dates.format(user.getBirthday(),'yyyy-MM-dd')}">
                                        <span class="input-group-addon">
                               <span class="glyphicon glyphicon-calendar"></span>
                            </span>
                                    </div>
                                </div>
                                </div>

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-3" for="regdate">入职日期<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                    <div class="input-group date col-md-3 col-sm-3 col-xs-3" id="regdate">
                                        <input type="text" class="form-control" name="regdate" th:value="${#dates.format(user.getRegdate(),'yyyy-MM-dd')}">
                                        <span class="input-group-addon">
                               <span class="glyphicon glyphicon-calendar"></span>
                            </span>
                                    </div>
                                </div>
                                </div>

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12">学历<span class="required" >*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <select id="education_detail"  class="form-control" name="education">
                                            <option th:each="edu : ${educations}"
                                                    th:value="${edu.getId()}" th:text="${edu.getName()}" th:selected="${user.getEducation().getId() eq edu.getId()}"
                                            >
                                        </select>
                                    </div>
                                </div>
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="title_detail">职称<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <select id="title_detail"  class="form-control" name="title">
                                            <option th:each="title : ${titles}"
                                                    th:value="${title.getId()}" th:text="${title.getName()}" th:selected="${user.title.getId() eq title.getId()}"
                                            >
                                        </select>
                                    </div>
                                </div>
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="level_detail">能级<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <select id="level_detail" class="form-control" name="level">
                                                <option th:each="level : ${levels}"
                                                        th:value="${level.getId()}" th:text="${level.getName()}" th:selected="${user.level.getId() eq level.getId()}"
                                                >
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="pos_detail">职务<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <select id="pos_detail" multiple="multiple"  class="form-control" onchange="changePos()">
                                            <option th:each="pt : ${pos}"
                                                    th:value="${pt.getId()}" th:text="${pt.getName()}" th:selected="${user.getPositionList().contains(pt)}"
                                            >
                                        </select>
                                    </div>
                                </div>
                                <input type="hidden" name="positions" id="selectPos" value="">
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="phonenumber">手机号码<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input id="phonenumber" name="phonenumber" required="required" data-validate-length-range="8,20" class="form-control col-md-7 col-xs-12" th:value="${user.getPhonenumber()}">
                                    </div>
                                </div>
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="idnumber">身份证号码<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input id="idnumber" name="idnumber" required="required" data-validate-length-range="8,30" class="form-control col-md-7 col-xs-12" th:value="${user.getIdnumber()}">
                                    </div>
                                </div>

                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="regnumber">护士注册证号码<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input id="regnumber" name="regnumber" required="required" data-validate-length-range="8,20" class="form-control col-md-7 col-xs-12" th:value="${user.getRegnumber()}">
                                    </div>
                                </div>
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="bankaccount">银行卡账号<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input id="bankaccount" name="bankaccount" required="required" data-validate-length-range="8,30"  class="form-control col-md-7 col-xs-12" th:value="${user.getBankaccount()}">
                                    </div>
                                </div>
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="status_detail">状态<span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <select id="status_detail"  class="form-control" name="status">
                                            <option th:each="stat : ${status}"
                                                    th:value="${stat.getId()}" th:text="${stat.getName()}" th:selected="${user.getStatus().getId() eq stat.getId()}"
                                            >
                                        </select>
                                    </div>
                                </div>

                                <div class="ln_solid"></div>
                                <div class="form-group">
                                    <div class="col-md-6 col-md-offset-3">
                                        <button type="submit" class="btn btn-primary">Cancel</button>
                                        <button id="send" type="submit" class="btn btn-success" onload="getPos()">Submit</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


</html>
